UNPKG

pulse-dashboard

Version:

A Next.js Dashboard application for real-time monitoring and historical analysis of Playwright test executions, based on playwright-pulse-report. This component provides the UI for visualizing Playwright test results and can be run as a standalone CLI too

1 lines 32.2 kB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[847],{11235:(e,s,t)=>{"use strict";t.d(s,{TestDetailsClientPage:()=>ed});var a=t(95155),r=t(35695),l=t(7323),n=t(66695),i=t(30285),d=t(59409),c=t(12115),o=t(60704),m=t(59434);let u=o.bL,h=c.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(o.B8,{ref:s,className:(0,m.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r})});h.displayName=o.B8.displayName;let x=c.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(o.l9,{ref:s,className:(0,m.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...r})});x.displayName=o.l9.displayName;let p=c.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(o.UC,{ref:s,className:(0,m.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r})});p.displayName=o.UC.displayName;var g=t(68856),f=t(55365),j=t(66424),N=t(3638),v=t(58127),b=t(24371),w=t(11133),y=t(37648),A=t(50594),k=t(97990),T=t(15300),S=t(52333),F=t(60679),C=t(2448),L=t(12543),E=t(74601),D=t(79311),M=t(13768),O=t(65064),_=t(68718),R=t(7270),z=t(58527),P=t(17569),X=t(3235),I=t(66766),H=t(26126),V=t(10549),$=t(48155);function B(e){let{status:s}=e;switch("string"==typeof s?s.toLowerCase():""){case"passed":return(0,a.jsx)(v.A,{className:"h-4 w-4 text-green-500 flex-shrink-0"});case"failed":return(0,a.jsx)(b.A,{className:"h-4 w-4 text-destructive flex-shrink-0"});case"skipped":return(0,a.jsx)(w.A,{className:"h-4 w-4 text-accent flex-shrink-0"});case"timedout":return(0,a.jsx)(y.A,{className:"h-4 w-4 text-destructive flex-shrink-0"});case"pending":return(0,a.jsx)(y.A,{className:"h-4 w-4 text-primary animate-pulse flex-shrink-0"});default:return(0,a.jsx)(A.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"})}}function W(e){var s;let{step:t,level:r=0}=e,l=t.steps&&t.steps.length>0,n=(0,a.jsxs)("div",{className:"flex flex-col space-y-2 ".concat(r>0?"pl-4 border-l border-muted ml-2":""),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between space-x-2",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 min-w-0",children:[(0,a.jsx)(B,{status:t.status}),(0,a.jsx)("span",{className:"text-sm font-medium text-foreground truncate",title:t.title,children:t.title}),t.isHook&&(0,a.jsx)(H.E,{variant:"outline",className:"text-xs px-1.5 py-0.5",children:t.hookType||"hook"})]}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:(s=t.duration)<1e3?"".concat(s,"ms"):"".concat((s/1e3).toFixed(2),"s")})]}),t.codeLocation&&(0,a.jsxs)("div",{className:"flex items-center text-xs text-muted-foreground space-x-1 pl-6",children:[(0,a.jsx)($.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:t.codeLocation})]}),t.errorMessage&&(0,a.jsxs)("div",{className:"pl-6 mt-1",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-destructive mb-0.5",children:"Error:"}),(0,a.jsx)("pre",{className:"bg-destructive/10 text-xs p-2 rounded-md whitespace-pre-wrap break-all font-code",children:(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,m.cA)(t.errorMessage)}})})]})]});return l?(0,a.jsx)(V.nD,{type:"single",collapsible:!0,className:"w-full py-1",children:(0,a.jsxs)(V.As,{value:"step-".concat(t.id),className:"border-none",children:[(0,a.jsx)(V.$m,{className:"p-1 hover:no-underline hover:bg-muted/50 rounded-md text-left [&[data-state=open]>svg]:rotate-90",children:n}),(0,a.jsx)(V.ub,{className:"pt-0 pb-0",children:(0,a.jsx)("div",{className:"mt-1",children:t.steps.map(e=>(0,a.jsx)(W,{step:e,level:r+1},e.id))})})]})}):(0,a.jsx)("div",{className:"py-2 px-1 hover:bg-muted/50 rounded-md",children:n})}var Z=t(34477);let G=(0,Z.createServerReference)("003795f4a9ea48f4064d3202c72700337341fad304",Z.callServer,void 0,Z.findSourceMapURL,"getRawHistoricalReports");var U=t(83540),J=t(93504),q=t(94754),K=t(96025),Q=t(16238),Y=t(94517),ee=t(24026),es=t(21374);let et=e=>{let{cx:s,cy:t,payload:r}=e;if(!s||!t||!r)return null;let l="hsl(var(--muted-foreground))";return"passed"===r.status?l="hsl(var(--chart-3))":"failed"===r.status||"timedOut"===r.status?l="hsl(var(--destructive))":"skipped"===r.status&&(l="hsl(var(--accent))"),(0,a.jsx)("circle",{cx:s,cy:t,r:5,fill:l,stroke:"hsl(var(--card))",strokeWidth:1})},ea=e=>{let{active:s,payload:t,label:r}=e;if(s&&t&&t.length){let e=t[0].payload;return(0,a.jsxs)("div",{className:"bg-card p-3 border border-border rounded-md shadow-lg",children:[(0,a.jsx)("p",{className:"label text-sm font-semibold text-foreground",children:"Date: ".concat(new Date(e.date).toLocaleString())}),(0,a.jsx)("p",{className:"text-xs text-foreground",children:"Duration: ".concat(el(e.duration))}),(0,a.jsx)("p",{className:"text-xs",style:{color:"passed"===e.status?"hsl(var(--chart-3))":"failed"===e.status||"timedOut"===e.status?"hsl(var(--destructive))":"hsl(var(--accent))"},children:"Status: ".concat(e.status)})]})}return null};function er(e){let{status:s}=e;switch(s){case"passed":return(0,a.jsx)(v.A,{className:"h-6 w-6 text-[hsl(var(--chart-3))]"});case"failed":return(0,a.jsx)(b.A,{className:"h-6 w-6 text-destructive"});case"skipped":return(0,a.jsx)(w.A,{className:"h-6 w-6 text-[hsl(var(--accent))]"});case"timedOut":return(0,a.jsx)(y.A,{className:"h-6 w-6 text-destructive"});case"pending":return(0,a.jsx)(y.A,{className:"h-6 w-6 text-primary animate-pulse"});default:return(0,a.jsx)(A.A,{className:"h-6 w-6 text-muted-foreground"})}}function el(e){if(e<1e3)return"".concat(e,"ms");let s=parseFloat((e/1e3).toFixed(2));if(s<60)return"".concat(s,"s");let t=Math.floor(s/60),a=parseFloat((s%60).toFixed(2));return"".concat(t,"m ").concat(a,"s")}function en(e){let{contentType:s}=e,t=s.toLowerCase();return t.includes("html")?(0,a.jsx)(k.A,{className:"h-6 w-6 text-blue-500"}):t.includes("pdf")?(0,a.jsx)(T.A,{className:"h-6 w-6 text-red-500"}):t.includes("json")?(0,a.jsx)(S.A,{className:"h-6 w-6 text-yellow-500"}):t.includes("csv")||t.startsWith("text/plain")?(0,a.jsx)(F.A,{className:"h-6 w-6 text-green-500"}):t.startsWith("text/")?(0,a.jsx)(T.A,{className:"h-6 w-6 text-gray-500"}):(0,a.jsx)(C.A,{className:"h-6 w-6 text-gray-400"})}function ei(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Attachment";return e&&"string"==typeof e&&e.split(/[/\\]/).pop()||s}function ed(e){var s,t,o,v,b;let{testId:y}=e,F=(0,r.useRouter)(),{currentRun:V,loadingCurrent:$,errorCurrent:B}=(0,l.O)(),[Z,ed]=(0,c.useState)(null),[ec,eo]=(0,c.useState)([]),[em,eu]=(0,c.useState)([]),[eh,ex]=(0,c.useState)(!1),[ep,eg]=(0,c.useState)(null),ef=(0,c.useRef)(null),[ej,eN]=(0,c.useState)(null),[ev,eb]=(0,c.useState)(!1),[ew,ey]=(0,c.useState)(null),[eA,ek]=(0,c.useState)(!1),[eT,eS]=(0,c.useState)("current"),eF=(0,c.useMemo)(()=>{var e;return(null==V?void 0:null===(e=V.results)||void 0===e?void 0:e.find(e=>e.id===y))||null},[V,y]),eC=async()=>{if(Z){eb(!0),eN(null),ey(null);try{let e=await fetch("/api/analyze-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testName:Z.name,failureLogsAndErrors:Z.errorMessage||"",codeSnippet:Z.snippet||""})});if(!e.ok){let s=await e.json().catch(()=>({message:"Failed to parse error response"}));throw Error(s.message||"API request failed with status ".concat(e.status))}let s=await e.json();eN(s)}catch(e){console.error("Error generating AI suggestion:",e),ey(e instanceof Error?e.message:"An unknown error occurred.")}finally{eb(!1)}}};(0,c.useEffect)(()=>{ed(eF)},[eF]);let eL=(0,c.useCallback)(async()=>{var e;if(y&&!eA&&(null==eF?void 0:eF.suiteName)&&(null==V?void 0:null===(e=V.run)||void 0===e?void 0:e.timestamp)){ex(!0),eg(null);try{let e=(await G()).filter(e=>e.run.timestamp!==V.run.timestamp);eo(e);let s=[];e.forEach(e=>{let t=e.results.find(e=>e.id===y&&e.suiteName===eF.suiteName);t&&s.push({date:e.run.timestamp,duration:t.duration,status:t.status})}),s.sort((e,s)=>new Date(s.date).getTime()-new Date(e.date).getTime()),eu(s),ek(!0)}catch(e){console.error("Error fetching test history:",e),eg(e instanceof Error?e.message:"Failed to load test history")}finally{ex(!1)}}},[y,eA,eF,V]);(0,c.useEffect)(()=>{if("current"===eT)ed(eF);else{let e=ec.find(e=>e.run.timestamp===eT);(null==e?void 0:e.results)&&eF&&ed(e.results.find(e=>e.id===y&&e.suiteName===eF.suiteName)||null)}},[eT,eF,ec,y]);let eE=(0,c.useMemo)(()=>Z&&Array.isArray(Z.screenshots)?Z.screenshots.map((e,s)=>({name:ei(e,"Screenshot ".concat(s+1)),path:e,contentType:"image/png","data-ai-hint":"screenshot ".concat(s+1)})):[],[Z]),eD=(0,c.useMemo)(()=>Z&&Array.isArray(Z.videoPath)?Z.videoPath.map((e,s)=>({name:ei(e,"Video ".concat(s+1)),path:e,contentType:"video/mp4","data-ai-hint":"video ".concat(s+1)})):[],[Z]),eM=(0,c.useMemo)(()=>Z&&"string"==typeof Z.tracePath&&Z.tracePath?{name:ei(Z.tracePath,"trace.zip"),path:Z.tracePath,contentType:"application/zip"}:null,[Z]),eO=(0,c.useMemo)(()=>Z&&Array.isArray(Z.attachments)?Z.attachments.map((e,s)=>({name:e.name||ei(e.path,"Attachment ".concat(s+1)),path:e.path,contentType:e.contentType||"application/octet-stream","data-ai-hint":e["data-ai-hint"]})):[],[Z]),e_=(0,c.useMemo)(()=>eO.filter(e=>e.contentType.toLowerCase().includes("html")),[eO]),eR=(0,c.useMemo)(()=>eO.filter(e=>e.contentType.toLowerCase().includes("pdf")),[eO]),ez=(0,c.useMemo)(()=>eO.filter(e=>e.contentType.toLowerCase().includes("json")),[eO]),eP=(0,c.useMemo)(()=>eO.filter(e=>e.contentType.toLowerCase().startsWith("text/")||e.contentType.toLowerCase().includes("csv")),[eO]),eX=(0,c.useMemo)(()=>eO.filter(e=>!e_.includes(e)&&!eR.includes(e)&&!ez.includes(e)&&!eP.includes(e)),[eO,e_,eR,ez,eP]),eI=(0,c.useMemo)(()=>eE.length+eD.length+ +!!eM+eO.length,[eE,eD,eM,eO]),eH=e=>{switch(e){case"passed":return"bg-green-500";case"failed":case"timedOut":return"bg-red-500";case"skipped":return"bg-yellow-500";default:return"bg-gray-400"}},eV=(null==Z?void 0:Z.status)==="failed"||(null==Z?void 0:Z.status)==="timedOut";if($&&!Z)return(0,a.jsxs)("div",{className:"container mx-auto py-8 space-y-6",children:[(0,a.jsx)(g.E,{className:"h-10 w-48 mb-4 rounded-md"}),(0,a.jsxs)(n.Zp,{className:"shadow-xl rounded-lg",children:[(0,a.jsxs)(n.aR,{children:[(0,a.jsx)(g.E,{className:"h-8 w-3/4 mb-2 rounded-md"}),(0,a.jsx)(g.E,{className:"h-4 w-1/2 rounded-md"})]}),(0,a.jsxs)(n.Wu,{className:"space-y-4",children:[(0,a.jsx)(g.E,{className:"h-10 w-1/3 mb-4 rounded-md"}),(0,a.jsx)(g.E,{className:"h-40 w-full rounded-md"})]})]})]});if(B&&!Z)return(0,a.jsxs)("div",{className:"container mx-auto px-4 py-8",children:[(0,a.jsxs)(f.Fc,{variant:"destructive",className:"rounded-lg",children:[(0,a.jsx)(f.XL,{children:"Error loading test data"}),(0,a.jsx)(f.TN,{children:B})]}),(0,a.jsxs)(i.$,{onClick:()=>F.push("/"),variant:"outline",className:"mt-4 rounded-lg",children:[(0,a.jsx)(L.A,{className:"mr-2 h-4 w-4"})," Back"]})]});if(!Z)return(0,a.jsxs)("div",{className:"container mx-auto px-4 py-8 text-center",children:[(0,a.jsxs)(f.Fc,{className:"rounded-lg",children:[(0,a.jsx)(f.XL,{children:"Test Not Found"}),(0,a.jsxs)(f.TN,{children:["The test with ID '",y,"' could not be found in the current report."]})]}),(0,a.jsxs)(i.$,{onClick:()=>F.push("/"),className:"mt-6 inline-flex items-center justify-center rounded-xl border bg-transparent px-4 py-2 text-sm font-medium text-muted-foreground shadow-sm transition-all duration-300 ease-in-out hover:-translate-y-0.5 hover:shadow-lg hover:bg-primary hover:text-primary-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[(0,a.jsx)(L.A,{className:"mr-2 h-4 w-4"})," Back to Dashboard"]})]});let e$=function(e){if(!e)return"";let s=e.split(" > ");return s[s.length-1]||e}(Z.name);return(0,a.jsxs)("div",{className:"container mx-auto px-4 py-8 space-y-6",children:[(0,a.jsxs)(i.$,{onClick:()=>F.push("/"),className:"mt-6 inline-flex items-center justify-center rounded-xl border bg-transparent px-4 py-2 text-sm font-medium text-muted-foreground shadow-sm transition-all duration-300 ease-in-out hover:-translate-y-0.5 hover:shadow-lg hover:bg-primary hover:text-primary-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[(0,a.jsx)(L.A,{className:"mr-2 h-4 w-4"})," Back to Dashboard"]}),(0,a.jsxs)(n.Zp,{className:"shadow-xl rounded-lg",children:[(0,a.jsxs)(n.aR,{children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(n.ZB,{className:"text-2xl font-headline text-primary flex items-center",title:Z.name,children:[(0,a.jsx)(er,{status:Z.status}),(0,a.jsx)("span",{className:"ml-3",children:e$})]}),Z.suiteName&&(0,a.jsxs)(n.BT,{className:"mt-1 text-md",children:["From suite: ",Z.suiteName]}),(0,a.jsxs)("p",{className:"text-sm text-muted-foreground mt-2",children:["Run Date:"," ","current"===eT?$?(0,a.jsx)("span",{className:"text-muted-foreground",children:"Loading..."}):(null==V?void 0:null===(s=V.run)||void 0===s?void 0:s.timestamp)?(0,a.jsx)("span",{className:"font-medium",children:new Date(V.run.timestamp).toLocaleString()}):!B||(null==V?void 0:null===(t=V.run)||void 0===t?void 0:t.timestamp)?(0,a.jsx)("span",{className:"font-medium",children:"Not available"}):(0,a.jsx)("span",{className:"text-destructive font-medium",children:"Error loading date"}):(0,a.jsx)("span",{className:"font-medium",children:new Date(eT).toLocaleString()})]}),(0,a.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:[(0,a.jsxs)("p",{children:["ID: ",Z.id]}),Z.browser&&(0,a.jsxs)("p",{children:["Browser: ",Z.browser]})]})]}),(0,a.jsxs)("div",{className:"text-right flex-shrink-0",children:[(0,a.jsx)(H.E,{variant:"outline",className:"capitalize text-sm px-3 py-1 rounded-full border",style:function(e){switch(e){case"passed":return{backgroundColor:"hsl(var(--chart-3))",color:"hsl(var(--primary-foreground))"};case"failed":case"timedOut":return{backgroundColor:"hsl(var(--destructive))",color:"hsl(var(--destructive-foreground))"};case"skipped":return{backgroundColor:"hsl(var(--accent))",color:"hsl(var(--accent-foreground))"};case"pending":return{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))"};default:return{backgroundColor:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"}}}(Z.status),children:Z.status}),(0,a.jsxs)("p",{className:"text-sm text-muted-foreground mt-1",children:["Duration: ",el(Z.duration)]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Retries: ",Z.retries]}),Z.tags&&Z.tags.length>0&&(0,a.jsx)("div",{className:"mt-1 space-x-1",children:Z.tags.map(e=>(0,a.jsx)(H.E,{variant:"secondary",className:"text-xs rounded-full",children:e},e))})]})]}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsxs)(d.l6,{value:eT,onValueChange:eS,onOpenChange:e=>{e&&!eA&&eL()},children:[(0,a.jsx)(d.bq,{className:"w-full md:w-[350px] h-12 rounded-xl bg-card/50 border-2 border-transparent hover:border-primary/30 focus:ring-2 focus:ring-primary/50 focus:ring-offset-2 focus:ring-offset-background transition-colors duration-200 group",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(N.A,{className:"h-5 w-5 text-muted-foreground transition-colors group-hover:text-primary"}),(0,a.jsx)(d.yv,{placeholder:"Switch to a past run"})]})}),(0,a.jsxs)(d.gC,{sideOffset:8,className:"bg-card/80 backdrop-blur-lg border border-border/50 rounded-xl shadow-2xl data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",children:[(0,a.jsx)(d.eb,{value:"current",className:"rounded-lg",children:"Current Run"}),eh&&(0,a.jsx)(d.eb,{value:"loading",disabled:!0,className:"rounded-lg",children:"Loading history..."}),em.map(e=>(0,a.jsx)(d.eb,{value:e.date,className:"rounded-lg",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:(0,m.cn)("h-2 w-2 rounded-full",eH(e.status)),title:"Status: ".concat(e.status)}),(0,a.jsxs)("span",{className:"text-sm",children:[new Date(e.date).toLocaleString()," -"," ",(0,a.jsx)("span",{className:"font-medium capitalize",children:e.status})]})]})},e.date))]})]})})]}),(0,a.jsx)(n.Wu,{children:(0,a.jsxs)(u,{defaultValue:"steps",className:"w-full",onValueChange:e=>{"history"!==e||eA||eL()},children:[(0,a.jsxs)(h,{className:(0,m.cn)("grid w-full mb-4 rounded-lg",eV?"grid-cols-2 md:grid-cols-5":"grid-cols-2 md:grid-cols-4"),children:[(0,a.jsxs)(x,{value:"steps",children:["Execution Steps (",(null===(o=Z.steps)||void 0===o?void 0:o.length)||0,")"]}),(0,a.jsxs)(x,{value:"attachments",children:["Attachments (",eI,")"]}),(0,a.jsxs)(x,{value:"logs",children:[(0,a.jsx)(T.A,{className:"h-4 w-4 mr-2"}),"Logs"]}),(0,a.jsx)(x,{value:"history",children:"Test Run History"}),eV&&(0,a.jsxs)(x,{value:"ai-suggestions",children:[(0,a.jsx)(E.A,{className:"h-4 w-4 mr-2"}),"AI Suggestions"]})]}),(0,a.jsxs)(p,{value:"steps",className:"mt-4 p-1 md:p-4 border rounded-lg bg-card shadow-inner",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-3 px-3 md:px-0",children:"Test Execution Steps"}),Z.errorMessage&&(0,a.jsxs)("div",{className:"mb-4 p-3 md:p-0",children:[(0,a.jsx)("h4",{className:"font-semibold text-md text-destructive mb-1",children:"Overall Test Error:"}),(0,a.jsx)("pre",{className:"bg-destructive/10 text-sm p-4 rounded-lg whitespace-pre-wrap break-all font-code overflow-x-auto",children:(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,m.cA)(Z.errorMessage)}})})]}),Z.steps&&Z.steps.length>0?(0,a.jsx)(j.F,{className:"h-[600px] w-full",children:(0,a.jsx)("div",{className:"pr-4",children:Z.steps.map((e,s)=>(0,a.jsx)(W,{step:e},e.id||s))})}):(0,a.jsx)("p",{className:"text-muted-foreground p-3 md:p-0",children:"No detailed execution steps available for this test."})]}),(0,a.jsx)(p,{value:"attachments",className:"mt-4 p-1 md:p-4 border rounded-lg bg-card shadow-inner",children:(0,a.jsxs)(u,{defaultValue:"sub-screenshots",className:"w-full",children:[(0,a.jsx)(j.F,{className:"w-full whitespace-nowrap rounded-lg",children:(0,a.jsxs)(h,{className:"inline-grid w-max grid-flow-col mb-4 rounded-lg",children:[(0,a.jsxs)(x,{value:"sub-screenshots",disabled:0===eE.length,children:[(0,a.jsx)(D.A,{className:"h-4 w-4 mr-2"}),"Screenshots (",eE.length,")"]}),(0,a.jsxs)(x,{value:"sub-video",disabled:0===eD.length,children:[(0,a.jsx)(M.A,{className:"h-4 w-4 mr-2"}),"Videos (",eD.length,")"]}),(0,a.jsxs)(x,{value:"sub-trace",disabled:!eM,children:[(0,a.jsx)(O.A,{className:"h-4 w-4 mr-2"}),"Trace ",eM?"(1)":"(0)"]}),(0,a.jsxs)(x,{value:"sub-html",disabled:0===e_.length,children:[(0,a.jsx)(k.A,{className:"h-4 w-4 mr-2"}),"HTML (",e_.length,")"]}),(0,a.jsxs)(x,{value:"sub-pdf",disabled:0===eR.length,children:[(0,a.jsx)(T.A,{className:"h-4 w-4 mr-2"}),"PDF (",eR.length,")"]}),(0,a.jsxs)(x,{value:"sub-json",disabled:0===ez.length,children:[(0,a.jsx)(S.A,{className:"h-4 w-4 mr-2"}),"JSON (",ez.length,")"]}),(0,a.jsxs)(x,{value:"sub-text",disabled:0===eP.length,children:[(0,a.jsx)(T.A,{className:"h-4 w-4 mr-2"}),"Text/CSV (",eP.length,")"]}),(0,a.jsxs)(x,{value:"sub-other",disabled:0===eX.length,children:[(0,a.jsx)(C.A,{className:"h-4 w-4 mr-2"}),"Others (",eX.length,")"]})]})}),(0,a.jsxs)(p,{value:"sub-screenshots",className:"mt-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Screenshots"}),eE.length>0?(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:eE.map((e,s)=>{let t=(0,m.OX)(e.path);return"#"===t?null:(0,a.jsxs)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"relative aspect-video rounded-lg overflow-hidden group border hover:border-primary transition-all shadow-md hover:shadow-lg",children:[(0,a.jsx)(I.default,{src:t,alt:e.name||"Screenshot ".concat(s+1),fill:!0,style:{objectFit:"cover"},className:"group-hover:scale-105 transition-transform duration-300","data-ai-hint":e["data-ai-hint"]||"test screenshot"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-center justify-center p-2",children:(0,a.jsx)("p",{className:"text-white text-xs text-center break-all",children:e.name||"Screenshot ".concat(s+1)})})]},"img-preview-".concat(s))})}):(0,a.jsx)("p",{className:"text-muted-foreground",children:"No screenshots available for this test."})]}),(0,a.jsxs)(p,{value:"sub-video",className:"mt-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Video Recording(s)"}),(0,a.jsx)("div",{className:"space-y-4",children:eD.length>0?eD.map((e,s)=>(0,a.jsxs)("div",{className:"p-4 border rounded-lg bg-muted/30 shadow-sm flex items-center justify-between",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-foreground truncate",title:e.name,children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.$,{asChild:!0,variant:"ghost",size:"sm",children:(0,a.jsx)("a",{href:(0,m.OX)(e.path),target:"_blank",rel:"noopener noreferrer",children:"View"})}),(0,a.jsx)(i.$,{asChild:!0,variant:"outline",size:"sm",children:(0,a.jsxs)("a",{href:(0,m.OX)(e.path),download:e.name,children:[(0,a.jsx)(_.A,{className:"h-4 w-4 mr-2"}),"Download"]})})]})]},"video-".concat(s))):(0,a.jsxs)(f.Fc,{className:"rounded-lg",children:[(0,a.jsx)(A.A,{className:"h-4 w-4"}),(0,a.jsx)(f.XL,{children:"No Videos Available"}),(0,a.jsx)(f.TN,{children:"There is no video recording associated with this test run."})]})})]}),(0,a.jsxs)(p,{value:"sub-trace",className:"mt-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Trace File"}),eM?(0,a.jsxs)("div",{className:"p-4 border rounded-lg bg-muted/30 space-y-3 shadow-sm",children:[(0,a.jsxs)("a",{href:(0,m.OX)(eM.path),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-primary hover:underline text-base",download:eM.name,children:[(0,a.jsx)(_.A,{className:"h-5 w-5 mr-2"})," Download Trace File (",eM.name,")"]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Path: ",eM.path]}),(0,a.jsxs)(f.Fc,{className:"rounded-lg",children:[(0,a.jsx)(A.A,{className:"h-4 w-4"}),(0,a.jsx)(f.XL,{children:"Using Trace Files"}),(0,a.jsxs)(f.TN,{children:["Trace files (.zip) can be viewed using the Playwright CLI:"," ",(0,a.jsx)("code",{className:"bg-muted px-1 py-0.5 rounded-sm",children:"npx playwright show-trace /path/to/your/trace.zip"}),". Or by uploading them to"," ",(0,a.jsx)("a",{href:"https://trace.playwright.dev/",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"trace.playwright.dev"}),"."]})]})]}):(0,a.jsxs)(f.Fc,{className:"rounded-lg",children:[(0,a.jsx)(A.A,{className:"h-4 w-4"}),(0,a.jsx)(f.XL,{children:"No Trace File Available"}),(0,a.jsx)(f.TN,{children:"There is no Playwright trace file associated with this test run."})]})]}),[{value:"sub-html",title:"HTML Files",attachments:e_},{value:"sub-pdf",title:"PDF Documents",attachments:eR},{value:"sub-json",title:"JSON Files",attachments:ez},{value:"sub-text",title:"Text & CSV Files",attachments:eP},{value:"sub-other",title:"Other Files",attachments:eX}].map(e=>(0,a.jsxs)(p,{value:e.value,className:"mt-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:e.title}),(0,a.jsx)("div",{className:"space-y-3",children:e.attachments.length>0?e.attachments.map((e,s)=>(0,a.jsxs)("div",{className:"p-3 border rounded-lg bg-muted/30 shadow-sm flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 truncate",children:[(0,a.jsx)(en,{contentType:e.contentType}),(0,a.jsxs)("div",{className:"truncate",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-foreground truncate",title:e.name,children:e.name}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:e.contentType})]})]}),(0,a.jsxs)("div",{className:"flex items-center flex-shrink-0 gap-2",children:[(0,a.jsx)(i.$,{asChild:!0,variant:"ghost",size:"sm",children:(0,a.jsx)("a",{href:(0,m.OX)(e.path),target:"_blank",rel:"noopener noreferrer",children:"View"})}),(0,a.jsx)(i.$,{asChild:!0,variant:"outline",size:"sm",children:(0,a.jsxs)("a",{href:(0,m.OX)(e.path),download:e.name,children:[(0,a.jsx)(_.A,{className:"h-4 w-4 mr-2"}),"Download"]})})]})]},s)):(0,a.jsxs)(f.Fc,{className:"rounded-lg",children:[(0,a.jsx)(A.A,{className:"h-4 w-4"}),(0,a.jsx)(f.XL,{children:"No Files Available"}),(0,a.jsx)(f.TN,{children:"No attachments of this type were found for this test."})]})})]},e.value))]})}),(0,a.jsxs)(p,{value:"logs",className:"mt-4 p-4 border rounded-lg bg-card space-y-6 shadow-inner",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center",children:[(0,a.jsx)(R.A,{className:"h-5 w-5 mr-2 text-primary"}),"Console Logs / Standard Output"]}),(0,a.jsx)(j.F,{className:"h-48 w-full rounded-lg border p-3 bg-muted/30 shadow-sm",children:(0,a.jsx)("pre",{className:"text-sm whitespace-pre-wrap break-words font-code",children:(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,m.cA)(Z.stdout&&Array.isArray(Z.stdout)&&Z.stdout.length>0?Z.stdout.join("\n"):"No standard output logs captured for this test.")}})})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center",children:[(0,a.jsx)(w.A,{className:"h-5 w-5 mr-2 text-destructive"}),"Error Messages / Standard Error"]}),(0,a.jsx)(j.F,{className:"h-48 w-full rounded-lg border bg-destructive/5 shadow-sm",children:(0,a.jsx)("pre",{className:"text-sm p-3 whitespace-pre-wrap break-all font-code",children:(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,m.cA)(Z.errorMessage||"No errors captured for this test.")}})})})]}),Z.snippet&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center",children:[(0,a.jsx)(k.A,{className:"h-5 w-5 mr-2 text-primary"}),"Test Case Snippet"]}),(0,a.jsx)(j.F,{className:"h-48 w-full rounded-lg border p-3 bg-muted/30 shadow-sm",children:(0,a.jsx)("pre",{className:"text-sm whitespace-pre-wrap break-words font-code",children:(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,m.cA)(Z.snippet)}})})})]})]}),(0,a.jsxs)(p,{value:"history",className:"mt-4 p-4 border rounded-lg bg-card shadow-inner",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-3",children:(0,a.jsxs)("h3",{className:"text-lg font-semibold text-foreground flex items-center",children:[(0,a.jsx)(z.A,{className:"h-5 w-5 mr-2 text-primary"}),"Individual Test Run History"]})}),eh&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(g.E,{className:"h-6 w-3/4 rounded-md"}),(0,a.jsx)(g.E,{className:"h-64 w-full rounded-lg"})]}),ep&&!eh&&(0,a.jsxs)(f.Fc,{variant:"destructive",className:"rounded-lg",children:[(0,a.jsx)(w.A,{className:"h-4 w-4"}),(0,a.jsx)(f.XL,{children:"Error Loading Test History"}),(0,a.jsx)(f.TN,{children:ep})]}),!eh&&!ep&&eA&&0===em.length&&(0,a.jsxs)(f.Fc,{className:"rounded-lg",children:[(0,a.jsx)(A.A,{className:"h-4 w-4"}),(0,a.jsx)(f.XL,{children:"No Historical Data"}),(0,a.jsxs)(f.TN,{children:["No historical run data found for this specific test (ID:"," ",y,") in this suite."]})]}),!eh&&!ep&&em.length>0&&(0,a.jsx)("div",{ref:ef,className:"w-full h-[300px] bg-card p-4 rounded-lg shadow-inner",children:(0,a.jsx)(U.u,{width:"100%",height:"100%",children:(0,a.jsxs)(J.b,{data:[...em].reverse(),margin:{top:5,right:20,left:-20,bottom:5},children:[(0,a.jsx)(q.d,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),(0,a.jsx)(K.W,{dataKey:"date",tickFormatter:e=>new Date(e).toLocaleDateString("en-CA",{month:"short",day:"numeric"}),stroke:"hsl(var(--muted-foreground))",tick:{fontSize:10},angle:-30,textAnchor:"end",height:40}),(0,a.jsx)(Q.h,{tickFormatter:e=>el(e),stroke:"hsl(var(--muted-foreground))",tick:{fontSize:10},width:80}),(0,a.jsx)(Y.m,{content:(0,a.jsx)(ea,{})}),(0,a.jsx)(ee.s,{wrapperStyle:{fontSize:"12px"}}),(0,a.jsx)(es.N,{type:"monotone",dataKey:"duration",name:"Duration",stroke:"hsl(var(--primary))",strokeWidth:2,dot:(0,a.jsx)(et,{}),activeDot:{r:7}})]})})})]}),eV&&(0,a.jsx)(p,{value:"ai-suggestions",className:"mt-4 p-4 border rounded-lg bg-card shadow-inner",children:(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center text-center p-2 md:p-6",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center",children:[(0,a.jsx)(E.A,{className:"h-5 w-5 mr-2 text-primary"}),"AI-Powered Failure Analysis"]}),!(ev||ej||ew)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-muted-foreground text-sm mb-6 max-w-md",children:"Get suggestions from AI to help diagnose the root cause of this test failure and find potential solutions."}),(0,a.jsxs)(i.$,{onClick:eC,disabled:ev,children:[(0,a.jsx)(E.A,{className:"h-4 w-4 mr-2"}),"Generate Suggestion"]})]}),ev&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-10",children:[(0,a.jsx)(E.A,{className:"h-8 w-8 text-primary animate-pulse mb-4"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:"Generating suggestion... Please wait."})]}),ew&&(0,a.jsxs)("div",{className:"w-full text-left",children:[(0,a.jsxs)(f.Fc,{variant:"destructive",children:[(0,a.jsx)(f.XL,{children:"Error Generating Suggestion"}),(0,a.jsx)(f.TN,{children:ew})]}),(0,a.jsxs)(i.$,{onClick:eC,variant:"outline",size:"sm",className:"mt-4",children:[(0,a.jsx)(E.A,{className:"h-4 w-4 mr-2"}),"Try Again"]})]}),ej&&(0,a.jsxs)("div",{className:"text-left w-full mt-6 space-y-6",children:[(0,a.jsxs)(f.Fc,{variant:"default",className:"border-primary/30 bg-primary/5",children:[(0,a.jsx)(P.A,{className:"h-5 w-5 text-primary"}),(0,a.jsx)(f.XL,{className:"text-primary font-semibold",children:"Root Cause Analysis"}),(0,a.jsx)(f.TN,{className:"text-primary/90",children:ej.rootCause||"No root cause analysis provided."})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-foreground mb-2",children:"Affected Tests:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(null===(v=ej.affectedTests)||void 0===v?void 0:v.map(e=>(0,a.jsx)(H.E,{variant:"secondary",children:e},e)))||(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"N/A"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("h4",{className:"font-semibold text-foreground mb-3 flex items-center",children:[(0,a.jsx)(X.A,{className:"h-4 w-4 mr-2"}),"Suggested Fixes"]}),(0,a.jsxs)("div",{className:"space-y-4",children:[null===(b=ej.suggestedFixes)||void 0===b?void 0:b.map((e,s)=>(0,a.jsxs)(n.Zp,{className:"bg-card/50 shadow-md",children:[(0,a.jsx)(n.aR,{children:(0,a.jsxs)(n.ZB,{className:"text-base",children:["Suggestion #",s+1]})}),(0,a.jsxs)(n.Wu,{children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:e.description}),e.codeSnippet&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h5",{className:"text-xs font-semibold text-foreground mb-1 flex items-center",children:[(0,a.jsx)(k.A,{className:"h-3 w-3 mr-1.5"}),"Code Snippet:"]}),(0,a.jsx)("pre",{className:"bg-muted text-sm p-3 rounded-md whitespace-pre-wrap font-code overflow-x-auto",children:(0,a.jsx)("code",{children:e.codeSnippet})})]})]})]},s)),(!ej.suggestedFixes||0===ej.suggestedFixes.length)&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No specific fixes were suggested."})]})]}),(0,a.jsxs)(i.$,{onClick:eC,variant:"outline",size:"sm",className:"mt-4",children:[(0,a.jsx)(E.A,{className:"h-4 w-4 mr-2"}),"Regenerate Suggestion"]})]})]})})]})})]})]})}},50195:(e,s,t)=>{Promise.resolve().then(t.bind(t,11235))}},e=>{var s=s=>e(e.s=s);e.O(0,[638,972,729,616,441,684,358],()=>s(50195)),_N_E=e.O()}]);